<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>

  <body>
    <script src="../ajax.js"></script>

    <!-- 1*2*3*4 -->
    <script>
      const url = "http://localhost:8000/calc/multiply";

      ajax({
        url,
        data: { a: 1, b: 2 },
        onSuccess: (data) => {
          console.log(data);
          console.log("");

          /* 继续计算2*3 */
          ajax({
            url,
            data: { a: data, b: 3 },
            onSuccess: (data) => {
              console.log(data);
              console.log("");

              /* 继续计算 data*4 */
              ajax({
                url,
                data: { a: data, b: 4 },
                onSuccess: (data) => {
                  console.log(data);
                  console.log("");

                  ajax({
                    url,
                    data: { a: data, b: 5 },
                    onSuccess: (data) => console.log(data),
                  });
                },
              });
            },
          });
        },
      });
    </script>
  </body>
</html>
